package branch;

import java.util.Random;
import java.util.Scanner;

public class Test1
{
    public static void main(String[] args)
    {
       //test();
        //test1();
//        System.out.println(test2(6));
//        System.out.println(test2(4));
//        System.out.println(getcode(5));

        //test3();
        int i = 0;
        for(i = 101;i<=200;i++)
        {
            if(isPrime(i))
                System.out.println(i);

        }
    }

    public static void test()
    {
        //生成随机数：1-100
//        int num = (int)(Math.random()*100)+1;
//        System.out.println(num);
        Random r = new Random();
        int num = r.nextInt(100)+1;
        Scanner sc = new Scanner(System.in);
        while(true)
        {
            System.out.println("请输入猜测的数字：");
            int guessNumber = sc.nextInt();
            if(guessNumber>num)
            {
                System.out.println("猜大了");
            }
            else if (guessNumber<num)
            {
                System.out.println("猜小了");

            }
            else
            {
                System.out.println("恭喜你猜对了");
                break;
            }

        }


    }
    public static void test1()
    {
        Random r = new Random();
        int num = r.nextInt(27)+65;
        System.out.println(num);
    }

    public static String test2(int n)
    {
        String code = "";
        for(int i = 0;i<n;i++)
        {
            int type = (int)(Math.random()*3);//数字0 大写1 小写2
            switch(type)
            {
                case 0:
                    int num = (int)(Math.random()*10);
                    code += num;
                    break;
                case 1:
                    int big = (int)(Math.random()*26)+65;
                    code = code + (char)big;
                    break;
                case 2:
                    int small = (int)(Math.random()*26)+97;
                    code = code + (char)small;
                    break;
            }
        }
        return code;

    }

    public static String getcode(int n)
    {
        String code = "";
        int i = 0;
        for(i = 0;i < n;i++)
        {
            int type = (int)(Math.random()*3);
            switch(type)
            {
                case 0:
                    int num = (int)(Math.random()*10);
                    code+=num;
                    break;
                case 1:
                    int big = (int)(Math.random()*26)+65;
                    code += (char)big;
                    break;
                case 2:
                    int small = (int)(Math.random()*26)+97;
                    code += (char)small;
                    break;

            }
        }
        return code;
    }
    public static void test3()
    {
        int small = (int)(Math.random()*26)+97;
        System.out.println(small);
        String m = "";
        m += (char) small;
        System.out.println(m);
    }


    public static boolean isPrime(int n)
    {
        if(n<=1)
        {
            return false;
        }
        else
        {
            int j = 0;
            for (j = 2; j < Math.sqrt(n); j++)
            {
                if(n % j == 0)
                return false;

            }
        }
        return true;
    }




}

